Skip to content

tui/tabbar: Prevent closing the last remaining tab#1790

Merged
dgageot merged 1 commit intodocker:mainfrom
vvoland:ctrlwlasttab
Feb 19, 2026
Merged

tui/tabbar: Prevent closing the last remaining tab#1790
dgageot merged 1 commit intodocker:mainfrom
vvoland:ctrlwlasttab

Conversation

@vvoland
Copy link
Contributor

@vvoland vvoland commented Feb 19, 2026

Ignore close tab key (Ctrl+W) when only one tab remains open.

This prevents accidentally clearing the current session and preserves muscle memory for users who expect Ctrl+W to delete the last word in single-tab scenarios.

@vvoland vvoland requested a review from a team as a code owner February 19, 2026 10:19
Ignore close tab key (Ctrl+W) when only one tab remains open.

This prevents accidentally clearing the current session and preserves
muscle memory for users who expect Ctrl+W to delete the last word in
single-tab scenarios.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

✅ No issues found in the changed code.

The logic change from len(t.tabs) == 0 to len(t.tabs) <= 1 correctly implements the stated goal of preventing the last remaining tab from being closed. The condition properly handles both the edge case of 0 tabs and the main scenario of 1 tab, returning nil (no-op) in both cases.

@dgageot dgageot merged commit 71406e6 into docker:main Feb 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants